//package com.site.springboot.core.service.impl;
//
//import com.site.springboot.core.service.TokenService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.stereotype.Service;
//import org.springframework.util.StringUtils;
//
///**
// * Project:springboot-project-news-publish-system
// * ClassName:TokenServiceImpl
// * Package:com.site.springboot.core.service.impl
// * User:CWQ
// * Description:
// *
// * @Author 合肥-陈万琼
// * @Create 2024/5/27 23:56
// * @Version 1.0
// */
//@Service
//public class TokenServiceImpl implements TokenService {
//    @Autowired
//    private JwtService jwtService;
//    @Autowired
//    private UserDetailsServiceImpl userDetailsService;
//    @Autowired
//    private AuthenticationManager authenticationManager;
//
//    @Override
//    public String login(String userName, String password, String verifyCode) {
//        if(StringUtils.isEmpty(userName)||StringUtils.isEmpty(password)||StringUtils.isEmpty(verifyCode)){
//            throw new UsernameNotFoundException("非法参数");
//        }
//        Authentication authentication = authenticationManager.authenticate(
//                new UsernamePasswordAuthenticationToken(userName, password));
//        if (authentication.isAuthenticated()) {
//            return jwtService.generateToken(userName);
//        } else {
//            throw new UsernameNotFoundException("invalid user request!");
//        }
//    }
//}
